﻿using System;
using System.Collections.Generic;
using System.ComponentModel.Composition;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Compose;
using GalaSoft.MvvmLight.Messaging;

namespace ConsoleApplication1
{
    //[Export(typeof(CommandLine.ICommand))]
    //[ExportMetadata("CommandName", "hello")]

    [PartCreationPolicy(CreationPolicy.NonShared)]
    [CommandLine.Command(CommandName = "hello")]
    public class Class1:Compose.CmdLine 
    {
        //public string Execute(string input)
        //{
        //    string res= "你好，您输入了 " + input.Length + "个字符参数。";
        //    MessageLib.getMessage().Send<NotificationMessageAction<string>>(new NotificationMessageAction<string>(res, exe2),"class2");
        //    return res;
        //}

        public override string Execute(string input)
        {
            string res = "";
            if (input.Equals("name", StringComparison.CurrentCultureIgnoreCase))
            {
                res = "mName=" + mName;
            }
            else
            {
                mName = input;
                 res = "你好，您输入了 " + input.Length + "个字符参数。输入字符" + mName;
                SendMsg("hello", "sdfdsf");
            }
            return res;
        }

        public Class1():base("hello")
        {
        }

        public override void CallBack(string msg)
        {
            
            Console.WriteLine(mName+":"+msg);
        }



        public override string ReceiveMsg(string msg)
        {
            Console.WriteLine(mName + ":" + msg);
            return null;
        }

        public override void Dispose()
        {
            base.Dispose();
        }

    }
}
